﻿Imports LecturerAppointmentSystem.callback
Imports Facebook.FacebookSession
Imports System.Net
Imports LecturerAppointmentSystem.UserDetails

Public Class Login
    Inherits System.Web.UI.Page

    Dim facebookId As String = ""
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        'If Request.Cookies("fbs_" + FaceBookAppKey) Is Nothing Then

        'Else
        '    'Get user's facebook id
        '    Dim cookie As String = Request.Cookies("fbs_" + FaceBookAppKey).Value
        '    cookie = cookie.Replace("""", "")
        '    Dim facebookValues As NameValueCollection = HttpUtility.ParseQueryString(cookie)
        '    Dim fbJson As String = GetFacebookUserJSON(facebookValues("uid"), facebookValues("access_token"))
        '    Dim jsonHash As Hashtable = DirectCast(JSON.JsonDecode(fbJson), Hashtable)
        '    facebookId = TryCast(jsonHash("id"), String)
        '    Dim allUsers As Array = getAllUsersByFacebookId()
        '    If doesUserExist(allUsers, facebookId) Then
        '        Dim allRegisteredUsers As Array = getAllUsers()
        '        Dim userName As String = getUserName(allRegisteredUsers, facebookId)
        '        FormsAuthentication.RedirectFromLoginPage(userName, True)
        '        Response.Redirect("Default.aspx?fbid=" & facebookId)
        '    Else
        '        Response.Redirect("Register.aspx?fbid=" & facebookId)
        '    End If
        'End If
    End Sub
End Class